Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pnp): handle private import mappings #4862

Merged
merged 7 commits into from
Sep 28, 2022
Merged

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Sep 17, 2022

What's the problem this PR addresses?

Node.js supports an imports field in package.json that the PnP API doesn't support yet.
https://nodejs.org/dist/latest-v18.x/docs/api/packages.html#imports

Fixes #3843
Ref nodejs/node#40579

How did you fix it?

Extracted the required code from Node.js and adapted it to work with PnP.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@merceyz merceyz requested a review from arcanis as a code owner September 17, 2022 18:06
@merceyz merceyz force-pushed the merceyz/fix/pnp-imports branch from bbc640e to aa96387 Compare September 17, 2022 18:12
@RDIL
Copy link
Member

RDIL commented Sep 17, 2022

For the Node core code, should there be a plan in place for when and how to update it?

@merceyz merceyz force-pushed the merceyz/fix/pnp-imports branch 2 times, most recently from 5bb2dad to 600d4e9 Compare September 17, 2022 18:28
@arcanis
Copy link
Member

arcanis commented Sep 19, 2022

For the Node core code, should there be a plan in place for when and how to update it?

Usually we update whenever someone tells us something doesn't seem to work compared to Node - it's not ideal, and hopefully it'll work better if Node provides a blessed resolution library.

@merceyz merceyz force-pushed the merceyz/fix/pnp-imports branch from 600d4e9 to 240af2c Compare September 19, 2022 21:40
@merceyz merceyz marked this pull request as draft September 19, 2022 21:53
@merceyz merceyz marked this pull request as ready for review September 19, 2022 22:52
@merceyz merceyz marked this pull request as draft September 20, 2022 00:30
@merceyz merceyz force-pushed the merceyz/fix/pnp-imports branch from ac286f1 to b634e55 Compare September 25, 2022 13:57
@merceyz merceyz marked this pull request as ready for review September 25, 2022 13:59
@arcanis arcanis enabled auto-merge (squash) September 28, 2022 14:42
@arcanis arcanis merged commit 3092cfc into master Sep 28, 2022
@arcanis arcanis deleted the merceyz/fix/pnp-imports branch September 28, 2022 15:03
merceyz added a commit that referenced this pull request Sep 28, 2022
* fix(pnp): handle private import mappings

* refactor: don't use `assert`

* fix: forward extensions

* refactor: `resolvePrivateRequest`

* test: fix test for mapping to a dependency

* fix: legacy fallback when mapping

Co-authored-by: Maël Nison <nison.mael@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Support the imports field in the PnP API
3 participants